/**
 * 
 */
package com.p2p.front.service;

import java.util.Date;
import java.util.List;
import java.util.Map;

import com.github.pagehelper.PageInfo;
import com.p2p.base.model.Money;
import com.p2p.base.page.PageVo;
import com.p2p.front.dal.model.LoanInfo;
import com.p2p.front.dal.model.Tender;
import com.p2p.front.enums.TenderStatus;

/**
 * @author ruiqi
 *
 */
public interface TenderService {

	void save(Tender tender);

	Tender createTender(LoanInfo loanInfo, Long uid, String userAccountNo,
			String userName, Money amount, int auto, Integer autoRank);

	List<Tender> findByLoanId(Long lid);
	
	public List<Tender> findSuccesedByLoanId(Long lid);
	
	/**
	 * 根据标id和状态查询
	 * 
	 * @param lid
	 * @param tenderStatus
	 * @return
	 */
	List<Tender> findByLoanIdAndStatus(Long lid, TenderStatus tenderStatus);
	
	/**
	 * 根据标id和状态查询
	 */
	List<Tender> findByLoanIdAndStatusList(Long lid, List<Integer> statusList);

	List<Tender> findByUserId(String id);

	PageInfo queryPageByUserId(Long uid, int page, int rows);

	Tender getByTid(Long tid);

	Tender getByTidAndUid(Long tid, Long uid);

	boolean updateTenderStatus(Long tid, Integer status);

	boolean updateTenderStatusForLoanFull(Long tid, Integer status,
			Date fullTime);

	boolean updateTenderTstatus(Long tid, Integer tstatus);

	PageVo myLoanList(PageVo form);

	List<Map<String, Object>> myWaitLoanList(String uid);

	List<Map<String, Object>> findAll(Long lid);

	Map<String, Object> get(Long tid);

	Money sumTatalAmountByUid(String userId);

	/**
	 * 根据借款id查询当前借款被投标人数
	 * 
	 * @param lid
	 * @return
	 */
	int getTenderNumByLoanId(long lid);
}
